package com.elitesland.b2c.tms.entity;

import com.elitesland.core.base.BaseModel;
import com.elitesland.system.annotation.Comment;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * .
 *
 * @author fred
 * @date 2021-02-03
 */
@Entity
@Table(name = "tms_fare_tmpl", indexes = {
        @Index(name = "idx_tms_fare_tmpl_name", columnList = "name", unique = true)
})
@org.hibernate.annotations.Table(appliesTo = "tms_fare_tmpl", comment = "运费模板设置")
@Data
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
public class TmsFareTmplDO extends BaseModel implements Serializable {

    private static final long serialVersionUID = -8107691620234492864L;

    @Comment("模板名称")
    @Column(name = "name", columnDefinition = "varchar(256)", nullable = false, unique = true)
    private String name;

    @Comment("费用计算方式  UDC[TMS:FARE_CALC_METHOD] （WEIGHT：按重量计算，NUM：按商品件数计算）")
    @Column(name = "calc_method", columnDefinition = "varchar(32)", nullable = false)
    private String calcMethod;

    @Comment("首重（首件）")
    @Column(name = "weight_start", columnDefinition = "decimal(18,4)  default 0")
    private Double weightStart;

    @Comment("首费")
    @Column(name = "cost_start", columnDefinition = "decimal(18,6)  default 0")
    private BigDecimal costStart;

    @Comment("续重（续件）")
    @Column(name = "weight_increase", columnDefinition = "decimal(18,4)  default 0")
    private Double weightIncrease;

    @Comment("续费")
    @Column(name = "cost_increase", columnDefinition = "decimal(18,6)  default 0")
    private BigDecimal costIncrease;

    @Comment("是否启用")
    @Column(name = "enabled", columnDefinition = "tinyint(1) default 0")
    private Boolean enabled;
}
